<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <title>综合数据监控平台</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <!-- Le styles -->
    <script type="text/javascript" src="assets/js/jquery.js"></script>

    <link rel="stylesheet" href="assets/css/style.css">
    <link rel="stylesheet" href="assets/css/loader-style.css">
    <link rel="stylesheet" href="assets/css/bootstrap.css">

    <!-- 树形列表 -->
    <link rel="stylesheet" href="assets/js/tree/jquery.treeview.css">

    <link rel="stylesheet" href="assets/js/tree/treetable/stylesheets/jquery.treetable.css">
    <link rel="stylesheet" href="assets/js/tree/treetable/stylesheets/jquery.treetable.theme.default.css">
    <link href="assets/js/tree/tabelizer/tabelizer.min.css" media="all" rel="stylesheet" type="text/css">
    <!-- jqGrid -->
    <script type="text/ecmascript" src="assets/js/jqGrid/js/i18n/grid.locale-cn.js"></script>
    <script type="text/ecmascript" src="assets/js/jqGrid/src/jquery.jqGrid.js"></script>
    <link rel="stylesheet" type="text/css" media="screen" href="assets/js/jqGrid/css/ui.jqgrid-bootstrap.css" />
    
    <script>
        // $.jgrid.defaults.width = 1000;
        $.jgrid.defaults.responsive = true;
        $.jgrid.defaults.styleUI = 'Bootstrap';
        // $.jgrid.defaults.styleUI = 'jQueryUI';

    </script>

    <link rel="stylesheet" type="text/css" href="assets/css/myCss.css">

    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
        <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->
    <!-- Fav and touch icons -->
    <link rel="shortcut icon" href="assets/ico/favicon.ico">
    <style>
        /*模态框*/
        .modal-body-top {
            padding-bottom: 5px;
            border-bottom: 2px dotted #aaa;
            margin-bottom: 10px;
        }
        .modal {
            color:#777;
        }
        .modal .col-md-6{
            margin-bottom: 5px;
        }
        .modal input[type="date"], .modal input[type="file"], .modal select, .modal input[type="text"], .modal input[type="password"], .modal input[type="email"], .modal input[type="tel"] {
            line-height: 20px;
            width:260px;
            height:24px;
        }
        .modal input[type="file"] {
            display: inline-block;
        }
        #userRightModal .modal-body{
            height:500px;
            overflow-y: auto;
        }
    </style>
</head>

<body>
    <!-- Preloader -->
    <div id="preloader">
        <div id="status">&nbsp;</div>
    </div>
    <!-- TOP NAVBAR -->
    <nav role="navigation" class="navbar navbar-static-top">
        <div class="container-fluid">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button data-target="#bs-example-navbar-collapse-1" data-toggle="collapse" class="navbar-toggle" type="button">
                    <span class="entypo-menu"></span>
                </button>
                <button class="navbar-toggle toggle-menu-mobile toggle-left" type="button">
                    <span class="entypo-list-add"></span>
                </button>

                <div id="logo-mobile" class="visible-xs">
                   <h1>综合数据监控平台<span>v1.0</span></h1>
                </div>

            </div>


            <!-- Collect the nav links, forms, and other content for toggling -->
            <div id="bs-example-navbar-collapse-1" class="collapse navbar-collapse">
                <ul class="nav navbar-nav">
                    <!-- 帮助 -->
                    <li><a href="#"><i data-toggle="tooltip" data-placement="bottom" title="Help" style="font-size:20px;" class="icon-help tooltitle"></i></a>
                    </li>

                </ul>
                <!-- 时间天气框 -->
                <div id="nt-title-container" class="navbar-left running-text visible-lg">
                    <ul class="date-top">
                        <li class="entypo-calendar" style="margin-right:5px"></li>
                        <li id="Date"></li>
                    </ul>

                    <ul id="digital-clock" class="digital">
                        <li class="entypo-clock" style="margin-right:5px"></li>
                        <li class="meridiem"></li>
                        <li class="hour"></li>
                        <li>:</li>
                        <li class="min"></li>
                        <li>:</li>
                        <li class="sec"></li>
                    </ul>
                    <ul id="nt-title">
                        <li><i class="wi-day-lightning"></i>&#160;&#160;西安&#160;
                            <b>85</b><i class="wi-fahrenheit"></i>&#160; 
                        </li>
                        <li><i class="wi-day-lightning"></i>&#160;&#160;西安 &#160;
                            <b>70</b><i class="wi-fahrenheit"></i>&#160;; 夜晚- 72 °F (22.2 °C)
                        </li>

                        <li><i class="wi-day-lightning"></i>&#160;&#160;咸阳&#160;
                            <b>65</b><i class="wi-fahrenheit"></i>&#160;
                        </li>

                        <li><i class="wi-day-lightning"></i>&#160;&#160;渭南&#160;
                            <b>80</b><i class="wi-fahrenheit"></i>&#160;
                        </li>

                        <li><i class="wi-day-lightning"></i>&#160;&#160;汉中&#160;
                            <b>55</b><i class="wi-fahrenheit"></i>&#160;
                        </li>

                    </ul>
                </div>

                <ul style="margin-right:0;" class="nav navbar-nav navbar-right">
                    <li>
                        <a data-toggle="dropdown" class="dropdown-toggle" href="#">
                            <img alt="" class="admin-pic img-circle" src="assets/img/portraits/10.jpg">你好, 田七 <b class="caret"></b>
                        </a>
                        <ul style="margin-top:14px;" role="menu" class="dropdown-setting dropdown-menu">
                            <li>
                                <a href="profile.html">
                                    <span class="entypo-user"></span>&#160;&#160;头像</a>
                            </li>
                            <li>
                                <a href="#">
                                    <span class="entypo-vcard"></span>&#160;&#160;设置</a>
                            </li>
                            <li class="divider"></li>
                            <li>
                                <a href="login.html?b=1">
                                    <span class="entypo-logout"></span>&#160;&#160; 退出登录</a>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <a data-toggle="dropdown" class="dropdown-toggle" href="#">
                            <span class="icon-gear"></span>&#160;&#160;主题</a>
                        <ul role="menu" class="dropdown-setting dropdown-menu">

                            <li class="theme-bg">
                                <div id="button-bg"></div>
                                <div id="button-bg2"></div>
                                <div id="button-bg3"></div>
                                <div id="button-bg5"></div>
                                <div id="button-bg6"></div>
                                <div id="button-bg7"></div>
                                <div id="button-bg8"></div>
                                <div id="button-bg9"></div>
                                <div id="button-bg10"></div>
                                <div id="button-bg11"></div>
                                <div id="button-bg12"></div>
                                <div id="button-bg13"></div>
                            </li>
                        </ul>
                    </li>
                </ul>

            </div>
            <!-- /.navbar-collapse -->
        </div>
        <!-- /.container-fluid -->
    </nav>

    <!-- /END OF TOP NAVBAR -->

    <!-- SIDE MENU -->
    <div id="skin-select">
        <div id="logo">
            <img src="assets/img/logo.png" alt="大连睿科电子有限公司">
        </div>

        <a id="toggle">
            <span class="entypo-menu"></span>
        </a>


        <div class="skin-part">
            <div id="tree-wrap">
                <div class="side-bar">
                    <ul class="topnav menu-left-nest">
                        <li>
                            <a class="tooltip-tip ajax-load" href="index.html" title="首页">
                                <i class="icon-home"></i>
                                <span>首页</span>

                            </a>
                        </li>
                    </ul>

                    <ul class="topnav menu-left-nest">
                        <li>
                            <a href="#" style="border-left:0px solid!important;" class="title-menu-left">

                                <span class="widget-menu"></span>
                                <i data-toggle="tooltip" class="entypo-cog pull-right config-wrap"></i>

                            </a>
                        </li>

                        <li>
                            <a class="tooltip-tip ajax-load" href="realtime-data.html" title="实时数据">
                                <i class="icon-document-edit"></i>
                                <span>实时数据</span>

                            </a>
                        </li>
                        <li>
                            <a class="tooltip-tip ajax-load" href="chart-data.html" title="数据曲线">
                                <i class="icon-graph-line"></i>
                                <span>数据曲线</span>

                            </a>
                        </li>
                        <li>
                            <a class="tooltip-tip ajax-load" href="history-data.html" title="历史数据">
                                <i class="icon-document"></i>
                                <span>历史数据</span>

                            </a>
                        </li>
                    </ul>

                    <ul class="topnav menu-left-nest">
                        <li>
                            <a href="#" style="border-left:0px solid!important;" class="title-menu-left">

                                <span class="design-kit"></span>
                                <i data-toggle="tooltip" class="entypo-cog pull-right config-wrap"></i>

                            </a>
                        </li>

                        <li>
                            <a class="tooltip-tip ajax-load" href="device-manage.html" title="设备管理">
                                <i class="icon-view-thumb"></i>
                                <span>设备管理</span>

                            </a>
                        </li>
                        <li>
                            <a class="tooltip-tip ajax-load" href="user-manage.html" title="用户管理">
                                <i class="icon-user"></i>
                                <span>用户管理</span>

                            </a>
                        </li>
                        <li>
                            <a class="tooltip-tip ajax-load" href="login-record.html" title="登录日志">
                                <i class="icon-user-group"></i>
                                <span>登录日志</span>

                            </a>
                        </li>
                        <!-- <li>
                            <a class="tooltip-tip ajax-load" href="SIMinfo-manage.html" title="SIM卡信息管理">
                                <i class="icon-message"></i>
                                <span>SIM卡信息管理</span>

                            </a>
                        </li>
                        <li>
                            <a class="tooltip-tip ajax-load" href="#" title="系统设置">
                                <i class="icon-gear"></i>
                                <span>系统设置</span>

                            </a>
                        </li> -->
                    </ul>

                    <ul class="topnav menu-left-nest">
                        <li>
                            <a href="#" style="border-left:0px solid!important;" class="title-menu-left">

                                <span class="component"></span>
                                <i data-toggle="tooltip" class="entypo-cog pull-right config-wrap"></i>

                            </a>
                        </li>

                        <li>
                            <a class="tooltip-tip" href="warning-handle.html" title="报警处理">
                                <i class="icon-warning"></i>
                                <span>报警处理</span>
                            </a>
                        </li>
                        <li>
                            <a class="tooltip-tip" href="warning-config.html" title="报警设置">
                                <i class="icon-attachment"></i>
                                <span>报警设置</span>
                            </a>
                        </li>

                    </ul>


                </div>
            </div>
        </div>
    </div>
    <!-- END OF SIDE MENU -->



    <!--  PAPER WRAP -->
    <div class="wrap-fluid">
        <div class="container-fluid paper-wrap bevel tlbr">





            <!-- CONTENT -->
            <!--TITLE -->
            <div class="row">
                <div id="paper-top">
                    <div class="col-sm-3">
                        <h2 class="tittle-content-header">
                            <i class="icon-document"></i> 
                            <span>用户管理
                            </span>
                        </h2>

                    </div>

                    <div class="col-sm-7">
                        <div class="devider-vertical visible-lg"></div>
                        <div class="tittle-middle-header">

                            <div class="alert">
                                <button type="button" class="close" data-dismiss="alert">×</button>
                                <span class="tittle-alert entypo-info-circled"></span>
                                欢迎回来,&nbsp;
                                <strong>田七 !</strong>&nbsp;&nbsp;您上次登录是 昨天下午 16:54 
                            </div>


                        </div>

                    </div>
                </div>
            </div>
            <!--/ TITLE -->

            <!-- BREADCRUMB -->
            <ul id="breadcrumb">
                <li>
                    <span class="entypo-home"></span>
                </li>
                <li><i class="fa fa-lg fa-angle-right"></i>
                </li>
                <li><a href="#">系统管理</a>
                </li>
                <li><i class="fa fa-lg fa-angle-right"></i>
                </li>
                <li><a href="user-manage.html">用户管理</a>
                </li>
                <li class="pull-right">
                    <div class="input-group input-widget">
                        <input style="border-radius:15px" type="text" placeholder="搜索..." class="form-control">
                    </div>
                </li>
            </ul>

            <!-- END OF BREADCRUMB -->



            <div class="content-wrap">
                <div class="row">


                    <div class="col-sm-12">

                        <div class="nest" id="FootableClose">
                            <div class="title-alt">
                                <h6>
                                    用户列表
                                </h6>
                                <div class="top">
                                    <div class="form-group">
                                        
                                        <!-- <a href="#" class="btn btn-inverse" data-toggle="modal" data-target="#userRoleModal"><span class="entypo-attach"></span> 绑定角色</a> -->
                                        <a href="#" class="btn btn-inverse" data-toggle="modal" data-target="#userRightModal" id="a"><span class="entypo-link"></span> 绑定权限</a>
                                        <!-- <a href="#" class="btn btn-inverse" data-toggle="modal" data-target="#resetPwdModal"><span class="entypo-lock-open"></span> 重置密码</a> -->
                                        
                                    </div>
                                </div>
                                

                            </div>

                            <div class="body-nest">
                                <div style="clear:both;"></div>
                                <div class="row dataContent">
                                    <div class="col-xs-12 col-sm-12 col-md-2 form-group">
                                        <input type="checkbox" id="autosearch" onclick="enableAutosubmit(this.checked)"> 是否自动查询
                                    </div>
                                    <div class="col-xs-12 col-md-10 form-group">
                                        <label for="s_account">账号:</label>
                                        <input type="text" id="s_account" onkeydown="doSearch(arguments[0]||event)" />
                                        <label for="s_name">用户名:</label>
                                        <input type="text" id="s_name" onkeydown="doSearch(arguments[0]||event)" />
                                        <label for="s_clientname">客户名称:</label>
                                        <input type="text" id="s_clientname" onkeydown="doSearch(arguments[0]||event)" />
                                        <button class="btn btn-primary" onclick="gridReload()" id="submitButton" style="margin-left:30px;"><span class="entypo-search"></span> 查询</button>
                                        <input type="button" class="btn btn-success" value="导出EXCEL" >
                                    </div>
                                </div>

                                <table id="jqGrid"></table>
                                <div id="jqGridPager"></div>
                            </div>

                        </div>


                    </div>

                </div>
            </div>


            <!-- /END OF CONTENT -->



            <!-- FOOTER -->
            <!-- <div class="footer-space"></div> -->
            <div id="footer">
                <div class="devider-footer-left"></div>
                <div class="time">
                    <p id="spanDate">
                    <p id="clock">
                </div>
                <div class="copyright">
                        版权归 <a href="http://www.brjzbs.com/" title="西安天通物联网科技有限公司" target="_blank">西安天通物联网科技有限公司</a> 所有
                </div>
                <div class="devider-footer"></div>
            </div>
            <!-- / END OF FOOTER -->


        </div>
    </div>
    <!--  END OF PAPER WRAP -->

   
    <!-- 5. 账户绑定权限模态框 -->
    <div class="modal fade" id="userRightModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">账户绑定权限</h4>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-sm-6">
                            <h3>角色列表</h3>
                            <div class="treeLeft">
                                <div class="Check" id='role1'>
                                    <div class="tit"><span>超级管理员</span></div>
                                </div>
                                <div class="Check" id='role2'>
                                    <div class="tit"><span>管理员</span></div>
                                </div>
                                <div class="Check" id='role3'>
                                    <div class="tit"><span>普通用户</span></div>
                                </div>
                            </div>
                        </div>
                        <div class="col-sm-6">
                            <h3>权限菜单</h3>
                            <div class="tree"></div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <span class="pull-left" id="saving-status"></span>
                    <button type="button" class="btn btn-primary" id="btn">保存</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                </div>
            </div>
        </div>
    </div>

    <script type="text/javascript" src="assets/js/socket.io.js"></script>
    <script type="text/javascript" src="assets/js/ioconnect.js"></script>
    <script src="assets/js/md5.min.js"></script>
    <script type="text/javascript" src="assets/js/manage/commonSearch-jqgrid.js"></script>
    <script type="text/javascript" src="assets/js/manage/user-jqgrid.js"></script>
    <script type="text/javascript" src="assets/js/manage/commonPage-jqgrid.js"></script>

    <!-- MAIN EFFECT -->
    <script type="text/javascript" src="assets/js/preloader.js"></script>
    <script type="text/javascript" src="assets/js/bootstrap.js"></script>
    <script type="text/javascript" src="assets/js/app.js"></script>
    <script type="text/javascript" src="assets/js/load.js"></script>
    <script type="text/javascript" src="assets/js/main.js"></script>

    <script type="text/javascript">
        $.jgrid.defaults.width = $('.nest').css('width');
        // $("#gbox_jqGrid").setGridWidth($('#FootableClose .body-nest').width() - 30);
        // console.log($("#gbox_jqGrid").width())
        // console.log($('#FootableClose .body-nest').width())
        $(window).resize(function(){  
            $('.dataContent').css('width',$('#FootableClose .body-nest').width())
          $("#gbox_jqGrid").setGridWidth($('#FootableClose .body-nest').width());
        //   console.log($('#FootableClose .body-nest').width())
        });
        $("#a").click(function(){
            $('#userRightModal').modal({backdrop: 'static', keyboard: false});
        })

        var right1 = [
              { title: '设备管理', name: 'device', edit: 1, select: 1 },
              { title: '历史数据', name: 'log',  select: 1 },
              { title: '用户管理', name: 'user', edit: 1, select: 1 },
              { title: '权限管理', name: 'role', edit: 1, select: 1 },
              { title: '登录日志', name: 'logfile',  select: 1 },
              { title: '报警信息', name: 'warn_report',edit: 1, select: 1 },
              { title: '报警管理', name: 'warn_config',edit: 1, select: 1 }
            ];
            
            
            function DateHandle(data, fn){ // data是后台传参
                this.data = data
                this.fn = fn
                this.init()
            }
            DateHandle.prototype.init = function (){
                this.fixDate()
                this.slideDiv()
                this.checkHandle()
                this.checkInfinite()
                this.submitHandle()
            }
            DateHandle.prototype.fixDate = function (){
                var len = this.data.length;
                for(var i = 0; i < len; i++){
                    var strHtml = "<div class='Check' name='"+ this.data[i].name +"'>"+
                        "<div class='tit'><em></em><i></i><span>"+ this.data[i].title +"</span></div>"+
                        "<div class='tit-son'>"+
                        "</div>"+
                    "</div>"
                    $('.tree').append(strHtml);
                    
                    if( this.data[i].select != 'undefined' ){
                        if(this.data[i].select == '1'){
                            $('.tree .Check').eq(i).find('.tit-son').append("<div class='tit-son-cont actCheck'><i></i><span>查看</span></div>");
                        }
                        if(this.data[i].select == '0'){
                            $('.tree .Check').eq(i).find('.tit-son').append("<div class='tit-son-cont'><i></i><span>查看</span></div>");
                        }
                    }
                    if( this.data[i].edit != 'undefined' ){
                        if(this.data[i].edit == '1'){
                            $('.tree .Check').eq(i).find('.tit-son').append("<div class='tit-son-cont actCheck'><i></i><span>编辑</span></div>");
                        }
                        if(this.data[i].edit == '0'){
                            $('.tree .Check').eq(i).find('.tit-son').append("<div class='tit-son-cont'><i></i><span>编辑</span></div>");
                        }
                    }
                    
                }
            }
            DateHandle.prototype.slideDiv = function (){
                $('.tree .tit em').click(function(){
                    $(this).parent().toggleClass('actAdd').siblings('.tit-son').slideToggle()
                })
            }
            DateHandle.prototype.checkHandle = function (){
                $('.tree .tit i').click(function(){
                    var sonLen = $(this).parent().siblings('.tit-son').find('.tit-son-cont')
                    var num = 0;
                    if($(this).parent().hasClass('actCheck')){
                        $(this).parent().removeClass('actCheck')
                        $(sonLen).removeClass('actCheck')
                    }else{
                        $(this).parent().addClass('actCheck')
                        $(sonLen).addClass('actCheck')
                    }
                })
                $('.tree .tit-son i').click(function(){
                    var sonLen = $(this).parent().parent().find('.tit-son-cont')
                    var num = 0;
                    $(this).parent().toggleClass('actCheck');
                    for(var i = 0; i < sonLen.length; i++){
                        if($(sonLen).eq(i).hasClass('actCheck')){
                            num++;
                        }
                    }
                    if(num == sonLen.length){
                        $(this).parents('.Check').find('.tit').addClass('actCheck')
                    }else{
                        $(this).parents('.Check').find('.tit').removeClass('actCheck')
                    }
                })
                
                
                
            }
            DateHandle.prototype.submitHandle = function (){
                var _this = this;
                $('#btn').unbind('click')
                $('#btn').click(function(){
                    var len = $('.tree .Check').length
                    var arr = [];
                    for(var i = 0; i < len; i++ ){
                        var jsonDate = {}
                        
                        var esLen =  $('.tree .Check').eq(i).find('.tit-son .tit-son-cont')
                        
                        jsonDate.name = $('.tree .Check').eq(i).attr('name')
                        jsonDate.title = $('.tree .Check').eq(i).find('.tit span').html()
                        
                        
                        for(var h = 0; h < esLen.length; h++ ){
                            if( h == '0'){
                                jsonDate.select = Number($(esLen).eq(0).hasClass('actCheck'))
                            }
                            
                            if( h == '1'){
                                jsonDate.edit = Number($(esLen).eq(1).hasClass('actCheck'))
                            }                           
                        }
                        arr.push(jsonDate)
                        
                    }
                    
                    _this.fn(arr)
                    
                    console.log(arr)
                    
                })
            }
            DateHandle.prototype.checkInfinite = function(){ // 开始渲染的时候和总的关联
                var preLen = $('.tree .Check')
                for(var j = 0; j < preLen.length; j++){
                    var sonLen = $('.tree .Check:eq('+ j +') .tit-son-cont')
                    var num = 0;
                    for(var i = 0; i < sonLen.length; i++){
                        if($(sonLen).eq(i).hasClass('actCheck')){
                            num++;
                        }
                    }
                    if(num == sonLen.length){
                        $('.tree .Check:eq('+ j +') .tit').addClass('actCheck')
                    }else{
                        $('.tree .Check:eq('+ j +') .tit').removeClass('actCheck')
                    }
                }
            }

            
//          
            
            
            $(function(){
                $('.treeLeft .Check').click(function(){//点击角色列表 获取对应权限
                    $(this).addClass('actBg').siblings().removeClass('actBg');
                    $('.tree').empty(); // 清空所有
                    
                    var type = $(this).attr('id').replace(/[^0-9]/ig,"");
                    console.log(type)
                    b = null;
                    // console.log(select_url)
                    $.ajax({
                        type: 'POST',
                        url:  the_url + 'select_row/role',
                        data:{
                            "id": type //根据所选角色 获取角色权限
                        },
                        dataType: 'json', 
                        error: function(){
                            $('.tree').html('数据获取失败...')
                            // alert('error');
                        },
                        success: function(tt){
                            console.log('success');
                            console.log(tt);
                            if(tt.ret == 1){
                                var right;
                                if( tt.info[0].power == null) {
                                    right = [
                                        { title: '设备管理', name: 'device', edit: 0, select: 0 },
                                        { title: '历史数据', name: 'log',  select: 0 },
                                        { title: '用户管理', name: 'user', edit: 0, select: 0 },
                                        { title: '权限管理', name: 'role', edit: 0, select: 0 },
                                        { title: '登录日志', name: 'logfile',  select: 0 },
                                        { title: '报警信息', name: 'warn_report',edit: 0, select: 0 },
                                        { title: '报警管理', name: 'warn_config',edit: 0, select: 0 }
                                    ];
                                }else{ right = eval(tt.info[0].power); } //将power字符串转成 原对象数组，然后生成权限菜单
                                console.log(right)
                                console.log(tt.info[0].id)
                                console.log(tt.info[0].power)
                                var b = new DateHandle(right, function(obj){
                                    // alert(obj) // ajax  提交修改后的数据
                                    // console.log(JSON.stringify(obj))

                                    $.ajax({
                                        type: 'POST',
                                        url: edit_url + 'role' ,
                                        data: {
                                            "oper": "edit",
                                            "id": tt.info[0].id,
                                            "power": JSON.stringify(obj) //对象数组转成字符串 发送，不能直接发送！！！
                                        },
                                        dataType: 'json',
                                        // timeout: 1000,
                                        beforeSend: LoadFunction, //发送前
                                           
                                        success: succFunction, //发送成功 
                                        error: erryFunction,  //发送失败
                                    })
                                    function LoadFunction() {  
                                        // $("#btn").addClass('.btn-default').html('保存中...');
                                        $('#saving-status').html('保存中...')
                                    }  
                                    function erryFunction() {  
                                        // setTimeout(function () {
                                        //     $("#btn").addClass('btn-warning').html('保存失败');
                                        //     setTimeout(function () {
                                        //         $("#btn").attr('class','btn btn-primary').html('保存');
                                        //     }, 1000);
                                        // }, 500);
                                        // setTimeout(function() {
                                            $('#saving-status').html('保存成功...')   //为啥呢？保存成功却执行失败的代码。。。。
                                        // },500)
                                    }  
                                    function succFunction() {
                                        // setTimeout(function () {
                                        //     $("#btn").addClass('btn-success').html('保存成功');
                                        //     setTimeout(function () {
                                        //         $("#btn").attr('class','btn btn-primary').html('保存');
                                        //     }, 1000);
                                        // }, 500);
                                        // setTimeout(function() {
                                            $('#saving-status').html('保存成功')
                                        // },500)
                                    }
                                    
                                })  // menuData
                            }else {
                                $('.tree').html('数据获取失败...')
                            }
                        }
                    })
                    
                    
                    
                    
                })
            })
    </script>

</body>

</html>
